Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented May 30, 2023

Closes: #9838

Description

This PR increases the app's resilience when ProductVariation fields have unexpected types:

  • When a variation's SKU is a number instead of a String.
  • When a variation's weight is a number instead of a String.

It uses failsafe decoding to handle those alternative types, and adds to the unit test for parsing alternative types in a ProductVariation. (These are known decoding errors that users have experienced.)

Testing instructions

  1. Set a breakpoint in your tool of choice for requests to the /wc/v3/products endpoint.
  2. Build and run the app.
  3. Open the Products tab.
  4. Select a variable product.
  5. Select the Variations section in product details.
  6. Modify the response in one or both of the following ways:
    • A variation's SKU is a number (e.g. "sku": 123 or see the product-variation-alternative-types.json mock for an example).
    • A variation's weight is a number (e.g. "weight": 213).
  7. Execute the response and confirm the app loads the variation list.

Screenshots

Before After
Simulator Screen Shot - iPhone 14 Pro - 2023-05-30 at 16 53 42 Simulator Screen Shot - iPhone 14 Pro - 2023-05-30 at 16 54 43

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added feature: variation list Related to the variations list for variable products. category: reliability Related to app’s reliability, accuracy, and perceived waiting time labels May 30, 2023
@rachelmcr rachelmcr added this to the 13.9 milestone May 30, 2023
@rachelmcr rachelmcr marked this pull request as ready for review May 30, 2023 15:58
@rachelmcr rachelmcr requested review from Ecarrion and ThomazFB May 30, 2023 15:58
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 30, 2023

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr9847-e6fe097 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@Ecarrion Ecarrion self-assigned this May 31, 2023
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@rachelmcr rachelmcr enabled auto-merge May 31, 2023 15:52
@rachelmcr rachelmcr merged commit a5285cc into trunk May 31, 2023
@rachelmcr rachelmcr deleted the issue/9838-product-variation-decoding-errors branch May 31, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: reliability Related to app’s reliability, accuracy, and perceived waiting time feature: variation list Related to the variations list for variable products.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Reliability] Add fallbacks for known Product variation decoding errors

4 participants